#header{


  	 <!-- webuploader-css--上传文件 -->
    <link rel="stylesheet" href="/css_js/webuploader/webuploader.css" type="text/css" />
  }#
  
  #body{
 <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5></h5>
                </div>
                <div class="ibox-content">
                  <form method="post" action="<?php echo SplitUrl("homepage/column/musicupdate") ?>"> 
                  <input name="id" value="<?php echo isset($output[0])?$output[0]:'0' ?>" hidden/>
                   <input name="data[src]" id="src" value="<?php echo isset($output[0])?$output['src']:'0' ?>" hidden/>
                   
                   
                        <div class="form-horizontal m-t">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">标题：</label>
                                <div class="col-sm-5">                                    
                                  <input  class="form-control"  name="data[title]"  size="10" type="text" value="<?php echo isset($output[0])?$output['title']:'' ?>" />
                                    <span class="field-validation-error" veri-for="" ></span>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label class="col-sm-1 control-label">音乐地址</label>
                                <div class="col-sm-4">
                                    <div class="upload">
                                        <div class="uploadPreview1">
                                           <?php echo isset($output[0])?"<audio controls style=margin: auto; top 0; right 0; bottom 0; left 0; name=media src={$output['src']}></audio>":'暂无音乐' ?>
                                           
                                           
                                        </div>
                                        <div class="left">
                                            <div class="uploadProgressBar"></div>
                                            <div class="uploadBut1" id="uploadBut1">选择歌曲</div>    
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                </div>
                            </div>

                            
                           
                            
                         

                        <div class="form-group">
                            <div class="col-sm-2 col-sm-offset-1">
                                <button class="btn btn-primary" onclick="return submit_form()">保存</button>
                                <a href="<?php echo SplitUrl("homepage/column/music") ?>" class="btn btn-sm btn-white" > 返 回 </a>
                            </div>
                        </div>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

 
 
 }#
 
 
 #footer{

        	 <!-- webuploader-js--上传文件 -->
    <script src="/css_js/webuploader/webuploader.min.js"></script>
    <script type="text/javascript">
    	
    	
    	//验证输入
    	function verify(){
    		if($("input[name='data[title]']").val()==""){            
            $("[name='data[title]']").next().html('请输入标题')           	
            return false;
            }
            if($("#html").val()=="<p><br></p>"){        
            $("[veri-for='Body']").html('请输入内容')           	
            return false;
            }            
            return true;    		
    	}
    	
        function submit_form() {
            $("#html").val($("#Body").html());
            return verify();
        }
        
     
        
        
        
        //上传
           function upload(button, div, input) {

            var uploader = WebUploader.create({            	
                // 自动上传
                auto: true,
                // 选择文件的按钮
                pick: button,
                // swf文件路径
                swf: '/content/www/lib/webuploader/Uploader.swf',
                // 文件接收服务端。
                server: '<?php echo SplitUrl("homepage/column/MusicUp/file") ?>',
                method: 'POST'
            });
            uploader.on('uploadProgress', function (file, percentage) {
                $(div).html("上传中...");
            });

            uploader.on('uploadSuccess', function (file, response) {
                //文件效验
                if (response == "-1")//简单的图片上传需要验证
                    $(div).html('文件出错（超出服务器允许上传的体积，请设置php.ini）');
                else if (response == "-2")
                    $(div).html('类型不允许');
                else if (response == "-3")
                    $(div).html('文件太大'); 
                else {
                    //获取原始数据
                    var data = response._raw;                    
                    $(div).html("<audio controls autoplay style=\"margin: auto; top: 0; right: 0; bottom: 0; left: 0;\" name=\"media\" src=\"" + data + "\"></audio>");
                    $(input).val(data);
                }
            });

            uploader.on('uploadError', function (file) {
                $(div).html("上传失败");
            });


        }     
        //上传图片
        $(function () {
            upload('.uploadBut1', ".uploadPreview1", "#src");
        })



    </script>
         	
         	
   }#